package com.github.pig.admin.service.sys.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pig.admin.mapper.sys.roleUser.SysUserRoleMapper;
import com.github.pig.admin.model.entity.SysUserRole;
import com.github.pig.admin.service.sys.SysUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户角色表 服务实现类
 * </p>
 *
 * @author lengleng
 * @since 2017-10-29
 */
@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements SysUserRoleService {
    @Autowired
    private SysUserRoleMapper sysUserRoleMapper;

    /**
     * 根据用户Id删除该用户的角色关系
     *
     * @param userId 用户ID
     * @return boolean
     * @author 寻欢·李
     * @date 2017年12月7日 16:31:38
     */
    @Override
    public Boolean deleteByUserId(Integer userId) {
        return sysUserRoleMapper.deleteByUserIds(userId);
    }

    @Override
    public void updateSysUserRole(int userId,int id, Integer roleId) {
        sysUserRoleMapper.updateSysUserRole(userId,id,roleId);
    }
}
